package com.sms.web.system.dao;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import com.sms.web.system.entity.SysMenu;

/**
 * @desc 
 * @author wjw
 * @time 2017年11月16日下午3:33:11
 */
public interface SysMenuDao extends JpaRepository<SysMenu, String>, JpaSpecificationExecutor<SysMenu> {
    
	@Query(value="SELECT * FROM sys_menu  WHERE del_flag=0 "
	+ "AND id IN ( SELECT id FROM sys_role_menu WHERE role_id=?1) order by sort asc",nativeQuery=true)
    public List<SysMenu> findByRoleId(String roleId);
	
	@Query(value="FROM SysMenu  WHERE delFlag=0 AND parent is null order by sort asc")
	public List<SysMenu> findAllMenu();
    
}
